

package com.hazelcast.jet.impl.util;

public enum ProgressState {
    NO_PROGRESS(false, false), MADE_PROGRESS(true, false), DONE(true, true), WAS_ALREADY_DONE(false, true);

    private final boolean madeProgress;
    private final boolean isDone;

    ProgressState(boolean madeProgress, boolean isDone) {
        this.madeProgress = madeProgress;
        this.isDone = isDone;
    }

    public static ProgressState valueOf(boolean isMadeProgress, boolean isDone) {
        return isDone ? isMadeProgress ? ProgressState.DONE : ProgressState.WAS_ALREADY_DONE : isMadeProgress ? ProgressState.MADE_PROGRESS : ProgressState.NO_PROGRESS;

    }

    public boolean isMadeProgress() {
        return madeProgress;
    }

    public boolean isDone() {
        return isDone;
    }

}
